subroutine initCommon(a,i,i_time,START_SP_2D_FROM,START_SP_3D_FROM)
    dimension a(120000000),i(100000000)
    real*8 a,eps2d,eps3d,eps3dNS,radiusRED
    common /commonInfo/ eps2d,eps3d,eps3dNS,radiusRED,maxiter,typeTask,nt,nMaterials,calcWK,calcVP
    common /commonIndex/ indexI,indexA
    integer getMaterialsCount,typeTask,calcWK,calcVP,START_SP_2D_FROM,START_SP_3D_FROM

    !opening files
    call open_files_init_common()

    !common information
    i_time = 1
    call inputCommonInformation(a(i_time),START_SP_2D_FROM,START_SP_3D_FROM)
    call close_files_init_common()
    indexI=1
    indexA=i_time+nt
end
!*************************************************************************
subroutine open_files_init_common()
    common /files_common/infite_0,num_slae,log_txt,typeTask_txt
    integer typeTask_txt,today
    character*19 currentDT
    dimension today(3), now(3)

    call idate4(today(2),today(1),today(3))
    call itime(now)
1   format (i2.2, '-', i2.2, '-', i4.4, '_', i2.2, '-', i2.2, '-', i2.2 )
    write(currentDT,1) today(1),today(2),today(3),now(1),now(2),now(3)

    call makedirqq('.\logs')
    call makedirqq('.\results')
    call makedirqq('.\calculations')
    call makedirqq('.\calculations\A')
    call makedirqq('.\calculations\Hfi')
    call makedirqq('.\calculations\vp')
    call makedirqq('.\calculations\vp\wk')

    !time, slae, log, type of task
    infite_0 = 1
    num_slae = 2
    log_txt = 3
    typeTask_txt = 4

    open(infite_0,file='.\calculations\infite.0',mode='read')
    open(num_slae,file='.\calculations\num_slae.txt',mode='read')
    open(log_txt,file='.\logs\log_'//currentDT//'.txt',mode='write')
    open(typeTask_txt,file='.\calculations\typeTask.txt',mode='read')
end
!*************************************************************************
subroutine inputCommonInformation(time,START_SP_2D_FROM,START_SP_3D_FROM)
    common /files_common/infite_0,num_slae,log_txt,typeTask_txt
    common /commonInfo/ eps2d,eps3d,eps3dNS,radiusRED,maxiter,typeTask,nt,nMaterials,calcWK,calcVP
    integer typeTask_txt
    integer typeTask,calcWK,calcVP,START_SP_2D_FROM,START_SP_3D_FROM
    real*8 eps2d,eps3d,eps3dNS,radiusRED,time
    dimension time(*)

    read(infite_0,*) nt
    read(infite_0,*) (time(i),i=1,nt)
    read(num_slae,*) eps2d,eps3d,eps3dNS,radiusRED,maxiter

101 format('TASK2D=',i1)
102 format('TASK3D=',i1)
103 format('CHARACTERISTICS=',i1)
104 format('WK=',i1)
105 format('VP=',i1)
106 format('START_SP_2D_FROM=',i8)
107 format('START_SP_3D_FROM=',i8)
    read(typeTask_txt,101) k1
    read(typeTask_txt,102) k2
    read(typeTask_txt,103) k3
    read(typeTask_txt,104) calcWK
    read(typeTask_txt,105) calcVP
    if(k1.eq.0.and.k2.eq.0.and.k3.eq.0)then
        typeTask=0 
    elseif(k2.eq.1)then
        typeTask=3
    elseif(k1.eq.1)then
        typeTask=2
    else
        typeTask=1
    endif

    read(typeTask_txt,106) START_SP_2D_FROM
    read(typeTask_txt,107) START_SP_3D_FROM

    if(typeTask.eq.0.and.(calcWK.eq.1.or.calcVP.eq.1))typeTask=4
end
!*************************************************************************
subroutine close_files_init_common()
    common /files_common/infite_0,num_slae,log_txt,typeTask_txt
    integer typeTask_txt,sig3d
    close(infite_0)
    close(num_slae)
    close(typeTask_txt)
end
!*************************************************************************
!*************************************************************************
!*************************************************************************